import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../resource/ImagesConst";
import { ObjCreate } from "../common/ObjCreate";
import { BaseItem } from "../common/BaseItem";
import { GTextFormat } from "../../../common/GTextFormat";
import { ItemData } from "../../resource/info/ItemData";
import { ColorConfig } from "../../resource/ColorConfig";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
//class PrizeFallRender
    
    export  class PrizeFallRender extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._bg = ResouceConst.getScaleBitmap(ImagesConst.WardrobeBoeder);
            this._bg.setSize(88, 107);
            this._bg.x = 2;
            this._bg.y = 2;
            addChild(this._bg);
            ObjCreate.createBg(12, 12, 66, 66, this, ImagesConst.PackItemBg);
            ObjCreate.createBg(3, 80, 88, 20, this, ImagesConst.FightingStrgBg);
            this._baseItem = new BaseItem();
            this._baseItem.setSize(60, 60);
            this._baseItem.move(15, 15);
            this._baseItem.isDragAble = false;
            addChild(this._baseItem);
            var loc1=new GTextFormat("", 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._nameTxt = ObjCreate.createTextField("", 2, 80, 88, 20, this, loc1);
            this._nameTxt.mouseEnabled = false;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=null;
            var loc2=null;
            super.data = arg1;
            if (parseInt(arg1.data) > 0) 
            {
                loc1 = new ItemData(parseInt(arg1.data));
                this._baseItem.itemData = loc1;
                loc2 = ColorConfig.instance.getItemColor(loc1.color).color;
                this._nameTxt.htmlText = HTMLUtil.addColor(loc1.name, loc2);
            }
            return;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;
    }
